package com.vhall.component.entity.pendant.vo;

import com.vhall.component.framework.common.annotation.ParamName;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Objects;

/**
 * @author guoxin.wang
 * @date 2021/10/29
 */
@Data
public class PendantListPushPendantReqVO implements Serializable {

    private static final long serialVersionUID = -5331587527557558311L;

    /**
     * 房间id，后端根据房间id获取创建人id来实现逻辑
     */
    @NotBlank(message = "room_id参数不允许为空")
    @ParamName("room_id")
    private String roomId;

    /**
     * 模糊查询，仅支持名称
     */
    @ParamName("keyword")
    private String keyword;

    /**
     * 页码
     */
    @ParamName("page")
    @Min(value = 1, message = "page参数不允许小于1！")
    private Integer page = 1;

    /**
     * 每页数量
     */
    @ParamName("page_size")
    @Min(value = 1, message = "page_size参数不允许小于1！")
    private Integer pageSize = 10;

    public void setDefault() {
        if (Objects.isNull(page)) {
            page = 1;
        }
        if (Objects.isNull(pageSize)) {
            pageSize = 10;
        }
    }

}
